﻿''' <summary>
''' TMyEnginesクラス
''' </summary>
''' <remarks></remarks>
Public Class TMyEngines
    Private _List As New List(Of TMyEngine)
    Private _MyQuery As New TMyQuery
    ''' <summary>
    ''' コンストラクタ
    ''' </summary>
    ''' <param name="AConnection">TMySession</param>
    ''' <remarks></remarks>
    Public Sub New(ByVal AConnection As TMySession)
        _MyQuery.Session = AConnection
        Init()
    End Sub
    ''' <summary>
    ''' 件数
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public ReadOnly Property Count() As Integer
        Get
            Return _List.Count
        End Get
    End Property
    Default Public ReadOnly Property Items(ByVal Index As Integer) As TMyEngine
        Get
            Return _List(Index)
        End Get
    End Property
    Private Sub Init()
        _List.Clear()
        _MyQuery.Clear()
        _MyQuery.SQL.AppendLine("select")
        _MyQuery.SQL.AppendLine(" ENGINE")
        _MyQuery.SQL.AppendLine(",SUPPORT")
        _MyQuery.SQL.AppendLine(",COMMENT")
        _MyQuery.SQL.AppendLine(",TRANSACTIONS")
        _MyQuery.SQL.AppendLine(",XA")
        _MyQuery.SQL.AppendLine(",SAVEPOINTS")
        _MyQuery.SQL.AppendLine("from")
        _MyQuery.SQL.AppendLine(" information_schema.engines")
        _MyQuery.SQL.AppendLine("order by")
        _MyQuery.SQL.AppendLine(" engine")
        _MyQuery.Execute()
        While Not _MyQuery.Eof
            Dim item As New TMyEngine
            item._Engine = _MyQuery.FieldAsString("ENGINE")
            item._Support = _MyQuery.FieldAsString("SUPPORT")
            item._Comment = _MyQuery.FieldAsString("COMMENT")
            item._Transactions = _MyQuery.FieldAsString("TRANSACTIONS")
            item._Xa = _MyQuery.FieldAsString("XA")
            item._Savepoints = _MyQuery.FieldAsString("SAVEPOINTS")
            _List.Add(item)
            _MyQuery.MoveNext()
        End While
        _MyQuery.Close()
    End Sub
End Class
